package com.study.spmongodb.wwj.thread2.char01;

/**
 * @author MI
 * @version 1.0
 * @date 2020/12/6 20:41
 */
public class SingletObject4 {

    private static SingletObject4 instance;

    private SingletObject4() {
    }

    /**
     * 多线程情况下有问题
     */
    public static SingletObject4 getInstance() {
        if (null == instance) {
            synchronized (SingletObject4.class) {
                if (null == instance) {
                    instance = new SingletObject4();
                }
            }
        }
        return instance;
    }

}
